﻿using System.Web.UI;
using System.Web.UI.HtmlControls;

namespace AspDotnetPractice.UserControl
{
    
    public partial class Box : System.Web.UI.UserControl
    {
        protected override void OnPreRender(System.EventArgs e)
        {
            base.OnPreRender(e);
            //RegisterClientScript();
            //RegisterStyleSheet();
        }

        private void RegisterClientScript()
        {
            Page.ClientScript.RegisterClientScriptResource(GetType(), "AspDotnetPractice.UserControl.Box.js");
        }

        private void RegisterStyleSheet()
        {
            string webUrl = Page.ClientScript.GetWebResourceUrl(GetType(), "AspDotnetPractice.UserControl.Box.css");
            HtmlLink link = new HtmlLink {Href = webUrl};
            link.Attributes.Add("rel", "stylesheet");
            link.Attributes.Add("type","text/css");
            Page.Header.Controls.Add(link);
        }
    }
}